package cn.jiaqiang.chatgpt.data.domain.openai.model.aggregates;

import cn.jiaqiang.chatgpt.data.domain.openai.model.entity.MessageEntity;
import cn.jiaqiang.chatgpt.data.domain.openai.model.valobj.GenerativeModelVO;
import cn.jiaqiang.chatgpt.data.types.common.Constants;
import cn.jiaqiang.chatgpt.data.types.enums.ChatGPTModel;
import cn.jiaqiang.chatgpt.data.types.enums.OpenAiChannel;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @description 请求gpt的参数
 */
@Data
@Slf4j
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChatProcessAggregate {

    /** 用户ID */
    private String userId;
    /** token */
    private String token;
    /** 默认模型 */
    private String model = ChatGPTModel.GPT_3_5_TURBO.getCode();
    /** 问题描述 */
    private List<MessageEntity> messages;
    public OpenAiChannel getChannel(){
        return OpenAiChannel.getChannel(this.model);
    }

    // GLM-codegeex-4 -> codegeex-4
    public String getModelPlus() {
        log.error("asdf {}", this.model.substring(4));
        return this.model.substring(4);
    }

    public GenerativeModelVO getGenerativeModelVO() {
        switch (this.model) {
            case "dall-e-2":
            case "dall-e-3":
                return GenerativeModelVO.IMAGES;
            default:
                return GenerativeModelVO.TEXT;
        }
    }

    public static void main(String[] args) {
        System.out.println("GLM-codegeex-4".substring(4));
    }

}
